package liangtWorkSpace.netty;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;


/**
 * @ClassName HttpServerInitializer
 * @Description : 功能说明
 * @Author : LiangT
 * @Date : 2020/7/4 20:46
 */
public class HttpServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        /* 处理Http 消息的编解码 */
        pipeline.addLast("httpServerCodec",new HttpServerCodec());
        /* 添加定义的channelHandler */
        pipeline.addLast("httpServerhandler",new HttpServerChannelHandler0());
    }
}
